package com.aistar.config;


import com.aistar.pojo.TravPraise;
import com.aistar.service.redis.TravPraiseService;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;

import java.text.SimpleDateFormat;

public class LikeTask extends QuartzJobBean {
    @Autowired
    private TravPraiseService travPraiseService;
    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        Logger log = LoggerFactory.getLogger(getClass());
        log.info("正在将redis里面的数据持久到数据库中！！！");
        //将 Redis 里的点赞信息同步到数据库里
        travPraiseService.transLikedFromRedis2DB();
        travPraiseService.transLikedCountFromRedis2DB();
    }
}
